<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/8/9
  Time: 0:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <title>列表页面</title>
</head>
<body>
<table>
    <tr>
        <th>类别</th>
        <th>品种</th>
        <th>产地</th>
        <th>总重量</th>
        <th>单价</th>
        <th>操作</th>
    </tr>
    <c:forEach var="list" items="${sessionScope.list}">
        <tr>
            <td>${list.type}</td>
            <td>${list.breed}</td>
            <td>${list.area}</td>
            <td>${list.weight}</td>
            <td>${list.price}</td>
            <td>
                <a href="Select?id=${list.fruitid}">详情</a>
                <a href="" onclick="Delet(${list.fruitid})">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
</body>
<script>
    function Delet(id) {
        let b = confirm("确定要删除吗?");
        if (b){
            $.getJSON("Delete",{"id":id},function (data) {
                if (data==true){
                    alert("删除成功")
                }
                location.href="index.jsp";
            });
        }
    }
</script>
</html>
